package com.cxs.commoneventtest.event;

import ohos.aafwk.content.Intent;
import ohos.aafwk.content.IntentParams;
import ohos.event.commonevent.CommonEventData;
import ohos.event.commonevent.CommonEventSubscribeInfo;
import ohos.event.commonevent.CommonEventSubscriber;

public class MyCommonEventSubscriber extends CommonEventSubscriber {

    public MyCommonEventSubscriber(CommonEventSubscribeInfo subscribeInfo) {
        super(subscribeInfo);
    }

    @Override
    public void onReceiveEvent(CommonEventData commonEventData) {
        Intent intent = commonEventData.getIntent();
        IntentParams params = intent.getParams();
        System.out.println(params.getParam("key1"));
        System.out.println("在UI线程中执行的不耗时方法");
    }
}
